//
//  ItemUseEffect.h
//  StarBugs
//
//  Created by ?? ? on 5/3/12.
//  Copyright 2012 antisword@playorca.com. All rights reserved.
//

#ifndef __ItemUseEffect_h__
#define __ItemUseEffect_h__

#include "cocos2d.h"

#define effectType_item 0
#define effectType_ufo  1

class ItemUseEffect : cocos2d::CCLayerColor
{
private:
    static ItemUseEffect *pItemUseEffect;
    cocos2d::CCPoint basePt;
    cocos2d::CCSprite *effectSprite[7];
    cocos2d::CCSprite *mainSprite;
    cocos2d::CCArray *frameArray;
    
    int boomCnt;
    int starCnt;
    bool actionEndFlg;
    void call_startRecall();
    void call_startLight();
    void call_startBoom();
    void call_startStar();
    void call_end();
    void boomTick(float dt);
    void startTick(float dt);
    
public:
    ~ItemUseEffect();
    ItemUseEffect();
    
    static ItemUseEffect& getInstance()
    {
        if(pItemUseEffect == NULL) pItemUseEffect = new ItemUseEffect;
        return *pItemUseEffect;
    }
    
    static ItemUseEffect* getInstancePtr()
    {
        if(pItemUseEffect == NULL) pItemUseEffect = new ItemUseEffect;
        return pItemUseEffect;
    }
    
    void initData();
    void destroyData();
    void startAction(cocos2d::CCPoint pt, int type);
    bool getActionEnd(){return actionEndFlg;};
    void initActionEnd(){actionEndFlg = false;};
    void pause();
    void resume();
};

#endif//__ItemUseEffect_h__